package cn.sc.allinpay.allfavour.business.common.adapter;

import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import cn.pai.common.adapter.BaseListAdapter;
import cn.sc.allinpay.allfavour.R;

/**
 * description：卡券类型Spinner适配器
 * author：pany
 * on 2018/10/26 16:23
 */
public class CouponTypeAdapter extends BaseListAdapter<String> {

    public CouponTypeAdapter(Context context, List<String> datas) {
        super(context, datas);
    }

    public CouponTypeAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_coupon_type, null);
            holder = new ViewHolder();
            holder.tvName = view.findViewById(R.id.tvName);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.tvName.setText(datas.get(i));
        return view;
    }

    static class ViewHolder {
        AppCompatTextView tvName;
    }
}
